package MassData;

use Exporter 'import';
#our @EXPORT = qw(%MonoTable %CompoundTable %PieceTable @hs_mod %MassLoss);
our @EXPORT = qw(%BasicInfo %GAGInfo);
## This package includes all the common elements that needed in GAG calculation.

my %MonoTable = (
	'C' => 12,
	'H' => 1.007825,
	'O' => 15.99491,
	'S' => 31.97207,
	'N' => 14.00307
);

my %CompoundTable = (
	## C6 H8 O6
	'hexa'	=> 6 * $MonoTable{'C'} + 8 * $MonoTable{'H'} + 6 * $MonoTable{'O'},
	## C6 H11 O4 N
	'glcn'	=> 6 * $MonoTable{'C'} + 11 * $MonoTable{'H'} + 4 * $MonoTable{'O'} + $MonoTable{'N'},
	## H2O
	'h2o'	=> 2 * $MonoTable{'H'} + $MonoTable{'O'},
	## SO3 Net mass.
	'sg'	=> $MonoTable{'S'} + 3 * $MonoTable{'O'},
	## C2H2O Net mass.
	'ac'	=> 2 * $MonoTable{'C'} + 2 * $MonoTable{'H'} + $MonoTable{'O'},
);

my %PieceTable = (
	'ch' => $MonoTable{'C'} + $MonoTable{'H'},
	'ch2o'	=> $MonoTable{'C'} + 2 * $MonoTable{'H'} + $MonoTable{'O'},
	'c2h4o'	=> 2 * $MonoTable{'C'} + 4 * $MonoTable{'H'} + $MonoTable{'O'},
	'c2h2o2'=> 2 * $MonoTable{'C'} + 2 * $MonoTable{'H'} + 2 * $MonoTable{'O'}, 
	'ch3n'	=> $MonoTable{'C'} + 3 * $MonoTable{'H'} + $MonoTable{'N'},
	'o'	=> $MonoTable{'O'}
);

my %MassLoss = (
	'sg' => $MonoTable{'S'} + 3 * $MonoTable{'O'},
	'h2o'   => 2 * $MonoTable{'H'} + $MonoTable{'O'}, 
	'co2'	=> $MonoTable{'C'} + 2 * $MonoTable{'O'},	
);

our %BasicInfo = (
	'MonoTable' => \%MonoTable,
	'CompoundTable' => \%CompoundTable,
	'PieceTable'	=> \%PieceTable,
	'MassLoss'		=> \%MassLoss,
);

my @hs_mod = (
		[0,2],    # HexA
		#[0,1,2,3,5,13,15,23,25,35,135,235]    # GlcN
		[0,1,2,5,15,25],
);
my @unit = (
		[@PieceTable{'o', 'ch', 'ch2o', 'ch2o', 'ch', 'c2h2o2'}], # HexA
		[@PieceTable{'o', 'ch', 'ch3n', 'ch2o', 'ch', 'c2h4o'}], # GlcN
);
## If other monosaccharide are considered, its feature will be included here.
our %GAGInfo = (
	'HS'	=> {
				'modification'	=> \@hs_mod,
				'unit'			=> \@unit,
				'link'			=> [1,4],
			},

);
1;
